package week_home_work02;

import java.util.Scanner;

/**
 * @author zdl
 * @date 2024/11/22
 */
public class Demo24 {
    public static void main(String[] args) {
        //输入一个数字，输出该数字的各位数之和和积。
        Scanner sc =new Scanner(System.in);
        System.out.println("请输入一个整数:");
        int num = sc.nextInt();
        int yuanNum = num;
        int sum = 0;
        int product = 1;  //乘积
        while (num != 0){
            sum += num % 10;
            product *= num % 10;
            num /= 10;
        }
        System.out.println(yuanNum+"数字的各位数之和为:"+sum);
        System.out.println(yuanNum+"数字的各位数之乘积为:"+product);

    }
}
